<?php

namespace app\admin\controller;
use app\admin\services\AdminManualCourseService;
use think\App;
use think\Request;


/**
 * @手册课程标题管理
 */
class Adminmanualcourse extends Authent
{
    protected $manualGroupService;
    public function __construct(Request $request, App $app)
    {
        parent::__construct($request, $app);
        $this->manualGroupService = new AdminManualCourseService();
        global $authstate;
        
        if($authstate){
            if(isset($authstate['status']) && $authstate['status'] !=0 ){
                echo json_encode($authstate); die;
            }
        }
    }

    public function index()
    {
        $data = $this->manualGroupService->getParentData();
        if(empty($data[0])){
            echo '无数据权限！！';exit();
        }
        $this->assign('data',$data);
        return view('index');
    }
    
    /**
     * @保存数据
     */
    public function saveData(){
        $data = $this->manualGroupService->saveData();
        return $data;
    }
    
    /**
     * @修改状态
     */
    public function editStatus(){
        $data = $this->manualGroupService->editStatus();
        return $data;
    }
    
    /**
     * @删除
     */
    public function del(){
        $data = $this->manualGroupService->del();
        return $data;
    }
    
    
    /**
     * @获取数据
     * @param int $pageIndex 当前页码
     * @param int $pageSize 每页条数
     * @param string $keyword 关键字查询
     * @param int $groupId 分类ID
     */
    public function getList(){
        $data = $this->manualGroupService->getListByPage();
        return json($data);
    }

}